﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService

Partial Class FrontEnd_Control_FooterTinTuc
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then

            Dim lstNode As New DataSet
            lstNode.ReadXml(MapPath("../../xml/Footer.xml"))
            With rptMenu
                .DataSource = lstNode.Tables("Node")
                .DataBind()
            End With
            Using _data As New VSEntities


                Dim lstNodeSEO = (From q In _data.Seos Select q Order By q.Sort).ToList
                With rtpFooterLink
                    .DataSource = lstNodeSEO
                    .DataBind()
                End With
            End Using

        End If

    End Sub

    Protected Sub rptMenu_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptMenu.ItemDataBound
        Dim ltrTitle As Literal
        ltrTitle = e.Item.FindControl("ltrTitle")
        ltrTitle.Text = "<li><a href='" & MainDomain & e.Item.DataItem("URL") & "'>" & e.Item.DataItem("Title") & "</a></li>"
    End Sub


    Protected Sub rtpFooterLink_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rtpFooterLink.ItemDataBound
        Dim hplTitle As HyperLink
        Dim row As VSModel.Seo = CType(e.Item.DataItem, VSModel.Seo)
        hplTitle = e.Item.FindControl("hplTitle")

        hplTitle.Text = "<h3>" & row.Title & "</h3>"

        hplTitle.ToolTip = row.Title

        hplTitle.Target = "_blank"
        hplTitle.NavigateUrl = row.Link
    End Sub
End Class
